<!---{
"title": "Building quick-lint-js on Windows from source",
"navTitle": "Win build"
}--->

<!DOCTYPE html>
<!-- Copyright (C) 2020  Matthew "strager" Glazar -->
<!-- See end of file for extended copyright information. -->
<html>
  <head>
    <%- await include("../../../common-head.ejs.html") %>
    <link href="../../../main.css" rel="stylesheet" />
  </head>
  <body class="side-bar-nav">
    <header><%- await include("../../../common-nav.ejs.html") %></header>

    <main>
      <h1><qljs-icon name="windows" size="29" /> <%= meta.title %></h1>

      <p>
        On Windows, you can build quick-lint-js using one of the following build
        systems:
      </p>
      <ul>
        <li>Visual Studio with CMake support (recommended)</li>
        <li>
          <a href="#visual-studio-sln"
            >Visual Studio with <code>.sln</code> generated by CMake</a
          >
        </li>
        <li>CMake &amp; Ninja with Visual Studio tools</li>
      </ul>

      <section id="visual-studio-sln">
        <h2>Visual Studio with <code>.sln</code> generated by CMake</h2>

        <h3>0. Install build dependencies</h3>

        <p>
          Before building quick-lint-js, install the following third-party
          dependencies:
        </p>
        <ul>
          <li><a href="https://cmake.org/">CMake</a> version 3.13 or newer</li>
          <li>
            <a href="https://visualstudio.microsoft.com/vs/"
              >Visual Studio 2019</a
            >
            or newer
          </li>
        </ul>

        <h3>1. Configure with CMake</h3>

        <p>
          Open <em>x64 Native Tools Command Prompt for VS</em>. Use
          <code>cd</code> to navigate to your quick-lint-js project directory.
          Run the following command to create a directory called
          <code>build</code>:
        </p>
        <blockquote>
          <pre><code class="shell-session windows"><span class="long-shell-command-line"><kbd>cmake -G &quot;Visual Studio 16 2019&quot; -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=1</kbd></span></code></pre>
        </blockquote>

        <h3>2. Build</h3>

        <p>
          Open the Visual Studio solution in the <code>build</code> directory:
        </p>
        <blockquote>
          <pre><code class="shell-session windows"><kbd>start build\quick-lint-js.sln</kbd></code></pre>
        </blockquote>

        <p>
          In Visual Studio, build the solution: press F6, or select the Build
          &gt; Build Solution menu option.
        </p>

        <h3>3. Run</h3>

        <p>
          Open the Solution Explorer panel, right-click the quick-lint-js-test
          project, and select the Set as StartUp Project menu option.
        </p>

        <p>
          Run the test program: press F5, or select the Debug &gt; Start
          Debugging menu option.
        </p>

        <p>
          If you want to run the quick-lint-js program, you can find it in
          <code>build\Debug\quick-lint-js.exe</code>. Run it from a command
          prompt or PowerShell window.
        </p>
      </section>

      <!-- TODO(strager): Document how to open CMake project directly with Visual Studio. -->
      <!-- TODO(strager): Document how to build with clang-cl. -->
    </main>

    <footer><%- await include("../../../common-footer-nav.ejs.html") %></footer>
  </body>
</html>

<!--
quick-lint-js finds bugs in JavaScript programs.
Copyright (C) 2020  Matthew "strager" Glazar

This file is part of quick-lint-js.

quick-lint-js is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

quick-lint-js is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with quick-lint-js.  If not, see <https://www.gnu.org/licenses/>.
-->
